home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / ltp_addhistory.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  1KB  |  54 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. /*****************************************************************************/
  15.  
  16. #include <intuition/sghooks.h>    /* For struct SGWork */
  17.  
  18. /*****************************************************************************/
  19.  
  20. #include "Assert.h"
  21.  
  22. /*****************************************************************************/
  23.  
  24. VOID
  25. LTP_AddHistory(struct SGWork *Work)
  26. {
  27.     ObjectNode *Node;
  28.  
  29.     if(GETOBJECT(Work->Gadget,Node))
  30.     {
  31.         if(Node->Special.String.HistoryHook)
  32.         {
  33.             struct MinList *List = Node->Special.String.HistoryHook->h_Data;
  34.  
  35.             while(Node->Special.String.NumHistoryLines >= Node->Special.String.MaxHistoryLines)
  36.             {
  37.                 CallHookPkt(Node->Special.String.HistoryHook,Work->Gadget,NULL);
  38.  
  39.                 Node->Special.String.NumHistoryLines--;
  40.             }
  41.  
  42.             Work->WorkBuffer[Work->NumChars] = 0;
  43.  
  44.             if(CallHookPkt(Node->Special.String.HistoryHook,Work->Gadget,Work->WorkBuffer))
  45.                 Node->Special.String.NumHistoryLines++;
  46.  
  47.             if(List->mlh_Head->mln_Succ)
  48.                 Node->Special.String.CurrentNode = (struct Node *)List->mlh_TailPred;
  49.             else
  50.                 Node->Special.String.CurrentNode = NULL;
  51.         }
  52.     }
  53. }
  54.